package com.yangtao.framework.dojo;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Dojo数据模型
 *
 * @author 杨涛
 * @version 1.0
 */
public class DojoDataModel {
	/**
	 * 主键标识，默认为Id
	 */
	private String identifier = "id";
	/**
	 * 显示名称，默认为name
	 */
	private String label = "name";
	/**
	 * 总记录条数，默认为-1
	 */
	private long numRows = -1;
	/**
	 * 结果列
	 */
	private Collection<?> items;

	public DojoDataModel() {
		super();
	}

	public DojoDataModel(Collection<?> items) {
		super();
		this.items = items;
	}

	public DojoDataModel(String label, Collection<?> items) {
		super();
		this.label = label;
		this.items = items;
	}

	public DojoDataModel(String identifier, String label, Collection<?> items) {
		super();
		this.identifier = identifier;
		this.label = label;
		this.items = items;
	}

	/**
	 * 增加数据类型
	 *
	 * @param o
	 */
	public void addData(Object o) {

	}

	/**
	 * @return the identifier
	 */
	public String getIdentifier() {
		return identifier;
	}

	/**
	 * @param identifier the identifier to set
	 */
	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	/**
	 * @return the label
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * @param label the label to set
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/**
	 * @return the items
	 */
	public Collection<?> getItems() {
		if (items == null) {
			items = new ArrayList<Object>();
		}
		return items;
	}

	/**
	 * @param items the items to set
	 */
	public void setItems(Collection<?> items) {
		this.items = items;
	}

	public long getNumRows() {
		return numRows;
	}

	public void setNumRows(long numRows) {
		this.numRows = numRows;
	}
}
